class Usuario < ActiveRecord::Base
  authenticates_with_sorcery!

  has_and_belongs_to_many :seguidores, class_name: "Usuario", foreign_key: "seguido_id", join_table: "seguidos_seguidores", association_foreign_key: "seguidor_id"
	has_and_belongs_to_many :seguidos, class_name: "Usuario", foreign_key: "seguidor_id", join_table: "seguidos_seguidores", association_foreign_key: "seguido_id"

  has_many :mensajes

  validates :nombre, presence: true
  validates :username, presence: true, uniqueness: true
  validates :email, presence: true, uniqueness: true
  validates :password, presence: true, confirmation: true, length: { minimum: 3}, :allow_blank => true
  validates :password_confirmation, presence: true
end
